package Test11_16;

import java.io.*;
import java.util.Scanner;

public class Test07 {
    public static void main(String[] args) {
        //一个模板文件wuliu. template的内容如下：
        //您的运单号为{danhao}的快件已到达{weizhi},请根据提取码{tiquma}提取，感谢您的支持
        BufferedReader bf = null;
        try {
            bf = new BufferedReader(new FileReader("D:\\aa\\物流 - 模版.txt"));
            String s = null;
            while ((s = bf.readLine()) != null) {
                System.out.println(s);
            }
            FileWriter writer = new FileWriter("D:\\aa\\物流.txt");
            //FileWriter wwriterriter = new FileWriter("D:\\aa\\bbb.txt");
            String newString=bf.readLine().replace("{danhao}", "张三");
            newString = s.replace("{weizhi}", "小狗");
            newString = s.replace("{tiquma}", "李四");
            System.out.println("替换后："+newString);

        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                bf.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
